package com.zy.product.configs;

import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @program: shopping147_cloud
 * @description:
 * @author: zy
 * @create: 2025-07-26 14:58
 */
//@Configuration
public class CorsConfig implements WebMvcConfigurer {  // WebMvcConfigurer:spring MVC配置接口
    //解决浏览器的跨域问题
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOrigins("*")
                .allowedMethods("GET", "POST", "PUT", "DELETE")
                .allowedHeaders("*")
                // .allowCredentials(true)
                .maxAge(3600);
    }


}
